﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Biz_Dal.Biz;

public partial class The_hien_TH_DANG_KY : System.Web.UI.UserControl
{
    BizKhachHang kh = new BizKhachHang();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnDangKy_Click(object sender, EventArgs e)
    {
        kh.tenDangNhap = txtTenDangNhap.Text;

        kh.matKhau = txtMatKhau1.Text;

        kh.hoTen = txtHoTen.Text;

        kh.email = txtEmail.Text;

        kh.diaChi = txtDiaChi.Value;

        kh.dienThoai = txtDienThoai.Text;

        kh.laQuanTri = false;

        kh.laUserXau = false;

        kh.taiKhoan = Convert.ToInt32(txtTaiKhoan.Text.ToString());
        
        if (BizKhachHang.insertKhachHang(kh) == 1)
        {
            Response.Write("<script>alert('Đăng ký thành công');</script>");
            Response.Redirect("~/Trang_web/Trang_chu.aspx");
        }
        else
        {
            Response.Write("<script>alert('Đăng ký không thành công');</script>");
            txtMatKhau1.Text = "";
            txtMatKhau2.Text = "";
        }
    }

}